package com.koron.order.risk.keyPoint.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.koron.bean.query.PageQuery;
import com.koron.order.risk.keyPoint.bean.dto.LineRiskKeyPointDTO;
import com.koron.order.risk.keyPoint.bean.po.LineRiskKeyPoint;
import com.koron.order.risk.keyPoint.bean.query.LineRiskKeyPointQuery;
import com.koron.order.risk.keyPoint.bean.vo.LineRiskKeyPointVO;
import org.koron.ebs.mybatis.SessionFactory;

import java.util.List;

/**
 * @author jzp
 * @since 2022/12/30
 */
public interface LineRiskKeyPointService {

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    LineRiskKeyPointVO getById(SessionFactory factory, String id);

    LineRiskKeyPointDTO getDtoById(SessionFactory factory, String id);

    /**
     * 查询所有数据
     *
     * @param query 查询条件对象
     * @return 列表结果集
     */
    List<LineRiskKeyPointVO> list(SessionFactory factory, LineRiskKeyPointQuery query);

    /**
     * 分页查询
     * @param query 分页条件
     * @return 对象列表
     */
    default PageInfo<LineRiskKeyPointVO> page(SessionFactory factory, PageQuery pageQuery, LineRiskKeyPointQuery query){
        PageHelper.startPage(pageQuery.getPage(), pageQuery.getPageSize(), pageQuery.getOrderBy());
        List<LineRiskKeyPointVO> lineRiskKeyPoints = list(factory, query);
        return new PageInfo<>(lineRiskKeyPoints);
    }

    boolean save(SessionFactory factory, LineRiskKeyPoint lineRiskKeyPoint);

}
